#include <iostream>

using namespace std;

/*
 *      struct 结构名 {结构体成员列表}
 *
 *      通过结构体创建变量  struct可省略
 *          struct 结构体名 变量名
 *          struct 结构体名 变量名 = {成员1值，成员2值，。。。}
 *          定义结构体是顺便创建变量
 */

struct Student {
    string name;
    int age;
}s3;

struct Teacher {
    string id;
    struct Student stu;
};

int main() {

    struct Student s1;
    s1.name = "1";
    s1.age = 1;

    struct Student s2 = {"2", 2};

    s3.name = "3";
    s3.age = 3;

    // 通过指针访问结构体变量中的数据
    Student * p = &s1;
    cout << p->name << " , " << p->age << endl;

    Teacher t1;
    t1.id = "1";
    t1.stu.name = "2";
    t1.stu.age = 2;

    return 0;
}
